package com.example.adminsystem.entity;

import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Data
@Entity
@Table(name = "role")
@EntityListeners(AuditingEntityListener.class) // 添加实体监听器,  用于自动填充创建时间和更新时间
public class Role {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String name;

    private String remark;

    private String routers;

    @CreatedDate // 自动填充创建时间
    private Date createdAt;

    @LastModifiedDate // 自动填充更新时间
    private Date updatedAt;
}
